
            (function() {
                function getCookie(name) {
                    var start = document.cookie.indexOf(name + "=");
                    var len = start + name.length + 1;
                    if ((!start) && (name != document.cookie.substring(0, name.length))) {
                        return null;
                    }
                    if (start == -1) {
                        return null;
                    }
                    var end = document.cookie.indexOf(";", len);
                    if (end == -1) {
                        end = document.cookie.length;
                    }
                    return unescape(document.cookie.substring(len, end));
                }
                function setCookie(name, value, expires, path, domain, secure) {
                    var str = name + "=" + escape(value);
                    if (expires > 0) {
                        var date = new Date();
                        date.setTime(date.getTime() + expires * 24 * 3600 * 1000);
                        str += ";expires=" + date.toGMTString();
                    }
                    if (path) {
                        str += ";path=" + path;
                    }

                    if (domain) {
                        str += ";domain=" + domain;
                    }

                    if (secure) {
                        str += ";secure=" + secure;
                    }
                    document.cookie = str;
                }
                function showCookiesMapping() {
                    var _this = this;
                    var url = "https://rtb.behe.com/bhex?callback=mappingCallbak&s=0";
                    var scriptObj = document.createElement("script");
                    scriptObj.src = url;
                    scriptObj.id = "jsonpBeheScript";
                    document.body.appendChild(scriptObj);
                    window.mappingCallbak = function(data) {
                        if (data.length > 0) {
                            for (var i = 0; i < data.length; i++) {
                                var n = data[i];
                                if (n != "") {
                                    var d = new Image(1, 1);
                                    d.src = n;
                                    d.onload = function() {
                                        d.onload = null;
                                    }
                                }
                            }
                            if (getCookie("behe_cookiesmapping_count") == null) {
                                setCookie("behe_cookiesmapping_count", 1, 7, "/", ".behe.com");
                            } else {
                                var count = (getCookie("behe_cookiesmapping_count") * 1) + 1;
                                setCookie("behe_cookiesmapping_count", count, 7, "/", ".behe.com");
                            }
                        } else {
                            setCookie("behe_cookiesmapping_st", "1", 7, "/", ".behe.com");
                        }
                    }
                }

                function getOldCookies(bhuid) {
                    var _this = this;
                    var url = "http://cm.myrtb.net/mp?bhuid=" + bhuid;
                    var img = new Image(1, 1);
                    img.src = url;
                    img.onload = function() {
                        img.onload = null;
                    }
                    setCookie("behe_cookiesmapping_old", "1", 365, "/", ".behe.com");
                }

                if (getCookie("bhuid") != null) {
                    if (getCookie("behe_cookiesmapping_st") == null) {
                        if (getCookie("behe_cookiesmapping_count") == null || getCookie("behe_cookiesmapping_count") * 1 <= 2) {
                            setTimeout(function() {
                                showCookiesMapping();
                            }, 3000);
                        }
                    }
                    if (getCookie("behe_cookiesmapping_old") == null) {
                        getOldCookies(getCookie("bhuid"));
                    }
                }
            })();